var express = require("express");
var router = express.Router();
var api = require("../config/api");

var Page = require("../controller/common/page")


router.get('/:var(api|api.html)', function(req, res, next) {
	res.render('api.html', {api1:api});
	
});

router.get('/:var(login|login.html)', function(req, res, next) {
	res.render('login.html',{title:"xxx"});
	
});

router.get('/', function(req, res, next) {
	if(Page.checkcookie(req,res))
        return res.redirect("/login.html");
	res.render('index.html', { title: 'Express' });
});

router.get('/:name', Page.page);

module.exports = router;